package com.ws.admin.post.service.impl;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.ws.admin.post.entity.PostReply;
import com.ws.admin.post.mapper.PostReplyMapper;
import com.ws.admin.post.service.IPostReplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ws.common.utils.PageUtils;

import java.util.List;

/**
 * <p>
 * 论坛-帖子回复 服务实现类
 * </p>
 *
 * @author weifucheng
 * @since 2019-11-26
 */
@Service
public class PostReplyServiceImpl extends ServiceImpl<PostReplyMapper, PostReply> implements IPostReplyService {

    @Override
    public Page<PostReply> list(PostReply postReply, Integer current, Integer size) {
        Page<PostReply> page= PageUtils.newPage(current, size);
        page.setRecords(baseMapper.listByParam(page,postReply));
        return page;
    }

    @Override
    public List<PostReply> list(PostReply postReply) {
        return baseMapper.listByParam(postReply);
    }

    @Override
    public List<PostReply> list(PostReply postReply, OrderItem orderItem) {
        Page<PostReply> page= PageUtils.newPage(1, 500);
        page.addOrder(orderItem);
        return baseMapper.listByParam(page,postReply);
    }
}
